package com.njwb.day10;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.Random;

public class Sss {
    public static void main(String[] args) {
        ArrayList<Integer> arrayList=new ArrayList<Integer>();
        Random random = new Random();
        for (int i = 0; i < 10; i++) {
            int num = random.nextInt(100); // 生成0~99之间的随机整数
            arrayList.add(num);
        }
        Iterator<Integer> aa= arrayList.iterator();
        while (aa.hasNext()){
            System.out.print(aa.next() + " ,");
        }
        System.out.println();
        arrayList.sort((a,b)->Integer.compare(a,b));
        Iterator<Integer> bb= arrayList.iterator();
        while (bb.hasNext()){
            System.out.print(bb.next() + " ,");

        }
        System.out.println();
        arrayList.sort((a,b)->Integer.compare(b,a));
        Iterator<Integer> cc= arrayList.iterator();
        while (cc.hasNext()){
            System.out.print(cc.next() + " ,");

        }
    }
}
